package com.zysd.collection.scheduler.system.config;

import com.lensyn.collect.common.enums.ProtocolEnum;
import com.zysd.collection.scheduler.service.common.ProtocolEnumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * spring bean静态化 方便系统参数获取
 *
 * @author hetao
 */
@Component
public class SysConfig {

    @Autowired
    private ProtocolEnumService protocolEnumService;

    private static SysConfig sysconfig;

    @PostConstruct
    public void init() {
        sysconfig = this;
        sysconfig.protocolEnumService = this.protocolEnumService;
    }

    public static ProtocolEnum convert(int region, int local) {
        return sysconfig.protocolEnumService.convert(region, local);
    }

    public static void  set(int region ,int local ,String protocol){
        sysconfig.protocolEnumService.set(region, local,protocol);
    }

}
